﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SMTPAPI.MainClass;

namespace SampleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string userName = "xxxxxx@gmail.com";
            string password = "xxxxxx";
            string toList   = "erandika1986@gmail.com,erandika34@yahoo.com";
            string ccList   = "erandika1986@gmail.com,erandika34@yahoo.com";
            string bccList  = "erandika1986@gmail.com,erandika34@yahoo.com";

            string mailBody     = "This is mail test body";
            string mailSubject  = "This is test subject";

            IList<string> attachments=new List<string>();
            attachments.Add(@"C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg");

            string htmlHeaderURL = "https://lh3.googleusercontent.com/__P_oiWPxElg/Tddb2Rf6ozI/AAAAAAAAAVg/GDLUpZYbVuc/mail_header_full.png";

            string mailSMTPServer   = "smtp.gmail.com";
            int mailServerSMTPPort  = 587;

            MailGenerator mailGenerator = new MailGenerator();

            try
            {
                bool result = mailGenerator.Generate(userName, password, toList
                    , ccList, bccList, attachments, mailBody, mailSubject, true, htmlHeaderURL
                    , mailSMTPServer, mailServerSMTPPort);

                if (result)
                {
                    Console.WriteLine("Succeed.");
                }
                else
                {
                    Console.WriteLine("Failed.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadLine();
        }
    }
}
